package com.ruoyi.drug.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.drug.domain.DrugsSupport;
import com.ruoyi.drug.mapper.DrugsSupportMapper;
import com.ruoyi.drug.service.IDrugsSupportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 供应商Service业务层处理
 *
 * @author ruoyi
 * @date 2022-11-13
 */
@Service
public class DrugsSupportServiceImpl implements IDrugsSupportService
{
    @Autowired
    private DrugsSupportMapper drugsSupportMapper;

    /**
     * 查询供应商
     *
     * @param supportId 供应商主键
     * @return 供应商
     */
    @Override
    public DrugsSupport selectDrugsSupportBySupportId(Long supportId)
    {
        return drugsSupportMapper.selectDrugsSupportBySupportId(supportId);
    }

    /**
     * 查询供应商列表
     *
     * @param drugsSupport 供应商
     * @return 供应商
     */
    @Override
    public List<DrugsSupport> selectDrugsSupportList(DrugsSupport drugsSupport)
    {
        return drugsSupportMapper.selectDrugsSupportList(drugsSupport);
    }

    /**
     * 新增供应商
     *
     * @param drugsSupport 供应商
     * @return 结果
     */
    @Override
    public int insertDrugsSupport(DrugsSupport drugsSupport)
    {
        drugsSupport.setCreateTime(DateUtils.getNowDate());
        return drugsSupportMapper.insertDrugsSupport(drugsSupport);
    }

    /**
     * 修改供应商
     *
     * @param drugsSupport 供应商
     * @return 结果
     */
    @Override
    public int updateDrugsSupport(DrugsSupport drugsSupport)
    {
        drugsSupport.setUpdateTime(DateUtils.getNowDate());
        return drugsSupportMapper.updateDrugsSupport(drugsSupport);
    }

    /**
     * 批量删除供应商
     *
     * @param supportIds 需要删除的供应商主键
     * @return 结果
     */
    @Override
    public int deleteDrugsSupportBySupportIds(Long[] supportIds)
    {
        return drugsSupportMapper.deleteDrugsSupportBySupportIds(supportIds);
    }

    /**
     * 删除供应商信息
     *
     * @param supportId 供应商主键
     * @return 结果
     */
    @Override
    public int deleteDrugsSupportBySupportId(Long supportId)
    {
        return drugsSupportMapper.deleteDrugsSupportBySupportId(supportId);
    }
}
